package com.icode50.spring.service.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import com.icode50.spring.entity.User;
import com.icode50.spring.mapper.UserMapper;
import com.icode50.spring.service.UserService;
import com.icode50.spring.service.redisService.RedisService;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private RedisTemplate redisTemplate;

    @Autowired
    private ListOperations<String,Object> listOperations;

    @Autowired
    private RedisService redisService;

    @Override
    public boolean addUser(User user){
        try {
            userMapper.addUser(user);
        }catch (Exception e){
            return false;
        }
        return true;
    }

    @Override
    public boolean updateUser(User user) {
        try {
            userMapper.updateUser(user);
        }catch (Exception e){
            return false;
        }
        return true;
    }

    @Override
    public boolean deleteUser(String userName) {
        try {
            userMapper.deleteUser(userName);
        }catch (Exception e){
            return false;
        }
        return true;
    }

	@Override
	public User getUserByUserName(String userName) {
		// TODO Auto-generated method stub
		return userMapper.getUserByUserName(userName);
	}

	@Override
	public List<User> getUserList() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public User getUserByUserId(String userId) {
		// TODO Auto-generated method stub
		return null;
	}

}
